export const Debounce = function(time: number = 500) {
  let evt: NodeJS.Timeout | null = null;
  return function(_target: any, _pro: string, descriptor: PropertyDescriptor) {
    const oldMethod = descriptor.value;
    descriptor.value = function(...args: any[]) {
      if (evt) {
        clearTimeout(evt);
        evt = null;
      }
      const that = this;
      evt = setTimeout(() => {
        oldMethod.apply(that, args);
      }, time);
    };
    return descriptor;
  };
};
